package com.edu.robot.modules.robot.controller;

import com.edu.robot.model.R;
import com.edu.robot.modules.robot.controller.vo.PageQuery;
import com.edu.robot.modules.robot.controller.vo.PromptVO;
import com.edu.robot.modules.robot.service.CrPromptService;
import jakarta.validation.constraints.NotBlank;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: KQAIA
 * @description:
 * @author: 无恙
 * @create: 2025-03-23 11:49
 **/

@RestController
@RequestMapping("/robot/prompt")
@Slf4j
public class PromptController {

	@Autowired
	private CrPromptService crPromptService;

	//新建提示词
	@PostMapping("/add")
	public R<?> addPrompt(@RequestBody @Validated PromptVO promptVO){
		return crPromptService.createPrompt(promptVO);
	}

	/*
	* @author 范铁凝
	* @date 2025/4/15
	* 修该提示词
	*/
	@PostMapping("/update")
	public R<?> updatePrompt(@RequestBody @Validated PromptVO promptVO){
		log.info("PromptController updatePrompt 修改提示词：{}",promptVO);
		return crPromptService.updatePrompt(promptVO);
	}

	/*
	* @author 范铁凝
	* @date 2025/4/15
	* 分页查询提示词
	*/
	@PostMapping("/list")
	public R<?> listPrompt(@RequestBody @Validated PageQuery<PromptVO> query){
		log.info("PromptController listPrompt 分页查询提示词：{}",query);
		return R.success(crPromptService.pagePrompt(query));
	}

}
